package com.sk.weichat.bean;

import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;

@DatabaseTable
public class Friend implements Serializable {

    public static final int STATUS_REPLAY_NONE = 0;//没有回复
    public static final int STATUS_REPLAY_SINGLE = 1;//单方回复
    public static final int STATUS_REPLAY_BOTH = 2;//双方回复

    public static final String ID_SYSTEM_MESSAGE = "10000";// 系统消息ID
    public static final String ID_NEW_FRIEND_MESSAGE = "10001";// 新好友消息 ID
    public static final String ID_SK_PAY = "1100";// 支付公众号，
    public static final String ID_BLOG_MESSAGE = "10002";// 商务圈消息ID
    public static final String ID_INTERVIEW_MESSAGE = "10004";// 面试中心ID（用于职位、初试、面试的推送）
    public static final String ID_SYSTEM_NOTIFICATION = "10005";// 系统号，用于各种控制消息通知，
    public static final String ID_GROUP_NOTIFICATION = "10006";// 群通知，
    // -1:黑名单；0：陌生人；1:单方关注；2:互为好友；8:显示系统号；9:非显示系统号
    public static final int STATUS_BLACKLIST = -1;// 黑名单
    public static final int STATUS_UNKNOW = 0;// 陌生人(不可能出现在好友表，只可能在新好友消息表)
    public static final int STATUS_ATTENTION = 1;// 关注
    public static final int STATUS_FRIEND = 2;// 好友
    public static final int STATUS_SYSTEM = 8;// 显示系统号
    public static final int STATUS_GROUP = 9;// 群通知
    public static final int STATUS_BE_ATTENTION = 5;// 被关注
    public static final int STATUS_BE_BLACK = 23;//对方把我加入了黑名单
    // 需要验证的
    public static final int STATUS_10 = 10; //显示  等待验证
    public static final int STATUS_11 = 11; //您好
    public static final int STATUS_12 = 12; //已通过验证
    public static final int STATUS_13 = 13; //验证被通过了
    public static final int STATUS_14 = 14; //别人回话
    public static final int STATUS_15 = 15; //回话
    public static final int STATUS_16 = 16; //已删除了XXX
    public static final int STATUS_17 = 17; //XXX删除了我
    public static final int STATUS_18 = 18; //你拉黑了XXX
    public static final int STATUS_19 = 19; //XXX拉黑了我
    public static final int STATUS_20 = 20; //默认值什么都不显示
    // 不需要验证的
    public static final int STATUS_21 = 21;//XXX 添加你为好友
    public static final int STATUS_22 = 22;//你添加好友 XXX
    public static final int STATUS_24 = 24;//XXX把你移出黑名单
    public static final int STATUS_25 = 25;//通过手机联系人添加
    public static final int STATUS_26 = 26;//被后台删除的好友，仅用于新的好友页面显示，
    public static final int STATUS_27 = 27;//你取关了XXX，解除好友关系
    public static final int STATUS_28 = 28;//XXX取关了你，解除好友关系
    public static final int STATUS_29 = 29;//你把XXX移出黑名单
    public static final int STATUS_30 = 30;//对方移粉你，解除好友关系
    public static final int STATUS_31 = 31;//你移除XX粉丝，解除好友关系
    private static final long serialVersionUID = -6859528031175998594L;
    @DatabaseField(generatedId = true)
    private int _id;

    @DatabaseField(canBeNull = false)
    private String ownerId; // 属于哪个用户的id

    @DatabaseField(canBeNull = false)
    private String userId; // 用户id或者聊天室id(jid)

    @DatabaseField(canBeNull = false)
    @JSONField(name = "nickname")
    private String nickName;// 用户昵称或者聊天室名称

    @DatabaseField
    private String description;// 签名

    @DatabaseField
    private long timeCreate;// 创建好友关系的时间

    @DatabaseField(defaultValue = "0")
    private int unReadNum; // 未读消息数量

    @DatabaseField
    private String content;// 最后一条消息内容

    @DatabaseField
    private int type;// 最后一条消息类型

    @DatabaseField
    private long timeSend;// 最后一条消息发送时间

    @DatabaseField(defaultValue = "0")
    private int roomFlag;// 0好友 1群组 510（我的联系人群组）

    @DatabaseField(defaultValue = "0")
    private int companyId; // 0表示不是公司

    @DatabaseField
    private int status;// -1:黑名单；0：陌生人；1:单方关注；2:互为好友；8:系统号；9:非显示系统号

    @DatabaseField(defaultValue = "0")
    private int isBeBlack;//被拉黑

    private long isBeBlackTime;

    @DatabaseField(defaultValue = "0")
    private int replyStatus;// 是否已回复:0，未回复；1、对方打招呼消息 2、双方回复

    @DatabaseField(defaultValue = "0")
    private int attentionTag;// 0未标记 1已经标记（私聊界面需要）

    @DatabaseField(defaultValue = "0")
    private long noticeTag;// 关闭公告中的时间（群聊界面需要）

    @DatabaseField
    private String privacy;// 隐私

    @DatabaseField
    private String remarkName;// 备注

    @DatabaseField
    private String describe;// 描述，

    @DatabaseField
    private int version;// 本地表的版本

    @DatabaseField
    private String roomId;// 仅仅当roomFlag==1，为群组的时候才有效(id)

    @DatabaseField
    private String roomCreateUserId;// 仅仅当roomFlag==1，为群组的时候才有效

    @DatabaseField
    private String roomMyNickName;// 我在这个群组的昵称

    @DatabaseField
    private int roomTalkTime;// 在这个群组的禁言时间

    @DatabaseField(defaultValue = "0")
    private long topTime;
    // 0:正常 1:被踢出该群组 2:该群已被解散 3:该群已被后台锁定
    @DatabaseField(defaultValue = "0")
    private int groupStatus;
    // 是否为设备，如果为设备，该Friend的userId为android || ios || pc...，之后需要在各个地方判断
    @DatabaseField(defaultValue = "0")
    private int isDevice;
    // 消息免打扰 0:未设置 1:已设置
    @DatabaseField(defaultValue = "0")
    private int offlineNoPushMsg;
    @DatabaseField(defaultValue = "0")
    private double chatRecordTimeOut;//0 || -1 消息永久保存 单位：day
    @DatabaseField(defaultValue = "0")
    private long downloadTime;// 最后一次同步消息的时间
    @DatabaseField(defaultValue = "0")
    private int isAtMe;// 是否有人@我 0 正常 1 @我 2 @全体成员
    @DatabaseField(defaultValue = "1")//判断是否是公开群  0是公开群 1是
    private int isLook;

    private int contextNum;//搜索聊天记录需求  相同相关信息的内容数量
    private long addBlackTime;//拉黑时间

    @DatabaseField(defaultValue = "0")
    private int groupMemberNum;//群成员数量

    public int getAttentionTag() {
        return attentionTag;
    }

    public void setAttentionTag(int attentionTag) {
        this.attentionTag = attentionTag;
    }

    public long getNoticeTag() {
        return noticeTag;
    }

    public void setNoticeTag(long noticeTag) {
        this.noticeTag = noticeTag;
    }

    public int getIsBeBlack() {
        return isBeBlack;
    }

    public void setIsBeBlack(int isBeBlack) {
        this.isBeBlack = isBeBlack;
    }

    public long getIsBeBlackTime() {
        return isBeBlackTime;
    }

    public void setIsBeBlackTime(long isBeBlackTime) {
        this.isBeBlackTime = isBeBlackTime;
    }

    public int getReplyStatus() {
        return replyStatus;
    }

    public void setReplyStatus(int replyStatus) {
        this.replyStatus = replyStatus;
    }

    public long getTopTime() {
        return topTime;
    }

    public void setTopTime(long topTime) {
        this.topTime = topTime;
    }

    public int getGroupStatus() {
        return groupStatus;
    }

    public void setGroupStatus(int groupStatus) {
        this.groupStatus = groupStatus;
    }

    public int getIsDevice() {
        return isDevice;
    }

    public void setIsDevice(int isDevice) {
        this.isDevice = isDevice;
    }

    public int getOfflineNoPushMsg() {
        return offlineNoPushMsg;
    }

    public void setOfflineNoPushMsg(int offlineNoPushMsg) {
        this.offlineNoPushMsg = offlineNoPushMsg;
    }

    public double getChatRecordTimeOut() {
        return chatRecordTimeOut;
    }

    public void setChatRecordTimeOut(double chatRecordTimeOut) {
        this.chatRecordTimeOut = chatRecordTimeOut;
    }

    public long getDownloadTime() {
        return downloadTime;
    }

    public void setDownloadTime(long downloadTime) {
        this.downloadTime = downloadTime;
    }

    public int getIsAtMe() {
        return isAtMe;
    }

    public void setIsAtMe(int isAtMe) {
        this.isAtMe = isAtMe;
    }

    public String getRoomId() {
        return roomId;
    }

    public void setRoomId(String roomId) {
        this.roomId = roomId;
    }

    public String getRoomCreateUserId() {
        return roomCreateUserId;
    }

    public void setRoomCreateUserId(String roomCreateUserId) {
        this.roomCreateUserId = roomCreateUserId;
    }

    public String getRemarkName() {
        return remarkName;
    }

    public void setRemarkName(String remarkName) {
        this.remarkName = remarkName;
    }

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public String getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(String ownerId) {
        this.ownerId = ownerId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickname) {
        this.nickName = nickname;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public long getTimeCreate() {
        return timeCreate;
    }

    public void setTimeCreate(long timeCreate) {
        this.timeCreate = timeCreate;
    }

    public int getUnReadNum() {
        return unReadNum;
    }

    public void setUnReadNum(int unReadNum) {
        this.unReadNum = unReadNum;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public long getTimeSend() {
        return timeSend;
    }

    public void setTimeSend(long timeSend) {
        this.timeSend = timeSend;
    }

    public int getRoomFlag() {
        return roomFlag;
    }

    public void setRoomFlag(int roomFlag) {
        this.roomFlag = roomFlag;
    }

    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getPrivacy() {
        return privacy;
    }

    public void setPrivacy(String privacy) {
        this.privacy = privacy;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public String getRoomMyNickName() {
        return roomMyNickName;
    }

    public void setRoomMyNickName(String roomMyNickName) {
        this.roomMyNickName = roomMyNickName;
    }

    public int getRoomTalkTime() {
        return roomTalkTime;
    }

    public void setRoomTalkTime(int roomTalkTime) {
        this.roomTalkTime = roomTalkTime;
    }

    public int getContextNum() {
        return contextNum;
    }

    public void setContextNum(int contextNum) {
        this.contextNum = contextNum;
    }

    public long getAddBlackTime() {
        return addBlackTime;
    }

    public void setAddBlackTime(long addBlackTime) {
        this.addBlackTime = addBlackTime;
    }

    public int getIsLook() {
        return isLook;
    }

    public void setIsLook(int isLook) {
        this.isLook = isLook;
    }

    public int getGroupMemberNum() {
        return groupMemberNum;
    }

    public void setGroupMemberNum(int groupMemberNum) {
        this.groupMemberNum = groupMemberNum;
    }

    /* 快捷方法，获取在好友列表中显示的名称 */
    public String getShowName() {
        if (!TextUtils.isEmpty(remarkName)) {
            return remarkName.trim();
        } else if (!TextUtils.isEmpty(nickName)) {
            return nickName.trim();
        } else {
            return "";
        }
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }
}
